home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1998 November / Cd users extra 14.iso / prog / inst / mailc / delete.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-14  |  1.2 KB  |  52 lines

  1. /*
  2. **  DELETE.C [edit EMAIL.H before compiling]
  3. **
  4. **  This program deletes the specified email 
  5. **  message on the SMTP server.
  6. */
  7.  
  8. #include <windows.h>
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include "see.h"
  12. #include "email.h"
  13.  
  14. static char Buffer[512];
  15.  
  16. void ErrorExit(int Code)
  17. {seeErrorText(Code,(LPSTR)Buffer,512);
  18.  printf("SEE Error %d: %s\n", Code, Buffer);
  19.  seeClose();
  20.  exit(1);
  21. }
  22.  
  23. void main(int argc, char *argv[])
  24. {int Code; 
  25.  int MsgNbr;
  26.  if(argc!=2)
  27.    {printf("Usage: DELETE <MsgNbr>\n");
  28.     exit(1);
  29.    }
  30.  MsgNbr = atoi(argv[1]); 
  31.  if((MsgNbr<1)||(MsgNbr>1000))
  32.     {printf("MsgNbr = %d out of range\n", MsgNbr);
  33.      exit(1);
  34.    }
  35.  /* define diagnostics log file */
  36.  ///seeStringParam(SEE_LOG_FILE, (LPSTR)"delete.log"); 
  37.  /* connect to POP3 server */
  38.  puts("Connecting...");
  39.  Code = seePop3Connect(
  40.     (LPSTR)POP3_HOST_NAME,              
  41.     (LPSTR)POP3_USER_NAME,               
  42.     (LPSTR)POP3_PASSWORD);      
  43.  if(Code<0) ErrorExit(Code); 
  44.  /* delete message  */
  45.  printf("Deleting message %d...\n",MsgNbr);
  46.  Code = seeDeleteEmail(MsgNbr);                   
  47.  if(Code<0) ErrorExit(Code); 
  48.  seeClose();
  49. } /* end main */
  50.  
  51.  
  52.